/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.thinkgem.jeesite.modules.product.service.catalog;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.common.service.CrudService;
import com.thinkgem.jeesite.modules.product.dao.catalog.GenCatalogDao;
import com.thinkgem.jeesite.modules.product.entity.catalog.GenCatalog;

/**
 * 商品类别Service
 * @author Egan
 * @version 2016-12-12
 */
@Service
@Transactional(readOnly = true)
public class GenCatalogService extends CrudService<GenCatalogDao, GenCatalog> {

	@Autowired
	private GenCatalogDao genCatalogDao;
	public GenCatalog get(String id) {
		return super.get(id);
	}
	
	public List<GenCatalog> findList(GenCatalog genCatalog) {
		return super.findList(genCatalog);
	}
	
	public Page<GenCatalog> findPage(Page<GenCatalog> page, GenCatalog genCatalog) {
		return super.findPage(page, genCatalog);
	}
	
	@Transactional(readOnly = false)
	public void save(GenCatalog genCatalog) {
		super.save(genCatalog);
	}
	
	@Transactional(readOnly = false)
	public void delete(GenCatalog genCatalog) {
		super.delete(genCatalog);
	}
	
	public List<GenCatalog> findRootList(GenCatalog genCatalog) {
		return genCatalogDao.findRootList(genCatalog);
	}
	
	public List<GenCatalog> getNextLevelStep(String parId) {
		return genCatalogDao.getNextLevelStep(parId);
	}
	
	public Page<GenCatalog> loadRoot(Page<GenCatalog> page, GenCatalog genCatalog) {
		genCatalog.setPage(page);
		page.setList(genCatalogDao.findRootList(genCatalog));
		return page;
	}
}